#include "sdl_timer.h"


sdl::Timer::Timer()
{
}


sdl::Timer::~Timer()
{
	stop();
}


void sdl::Timer::start(Uint32 interval)
{
	_id = SDL_AddTimer(interval, callback, this);
}


void sdl::Timer::stop()
{
	SDL_RemoveTimer(_id);
}


Uint32 sdl::Timer::callback(Uint32 interval, void* p)
{
	Timer* t = (Timer*)p;
	return t->onTimer(interval);
}

